package com.sys.db.daoImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.sys.db.dao.RunJobParaDao;
import com.sys.pojo.RunJobPara;

public class RunJobParaDaoImpl extends SqlMapClientDaoSupport implements RunJobParaDao {

	public void delete(int id) throws Exception {
		
		this.getSqlMapClientTemplate().delete("RunJobPara.delete",id);
	}

	public List findAll() throws Exception {
		List list=this.getSqlMapClientTemplate().queryForList("RunJobPara.findAll");
		return list;
	}
	public List findByPage(int start,int limit) throws Exception {
		
		Map map=new HashMap<String,Integer>();
		map.put("start", start);
		map.put("end", start+limit);
		List list=this.getSqlMapClientTemplate().queryForList("RunJobPara.findByPage",map);
		return list;
	}
	public RunJobPara findById(int id) throws Exception {
		
		RunJobPara d=(RunJobPara) this.getSqlMapClientTemplate().queryForObject("RunJobPara.findById",id);
		return d;
	}

	public void save(RunJobPara runJobPara) throws Exception {
		
		this.getSqlMapClientTemplate().insert("RunJobPara.insert",runJobPara);
	}

	public void update(RunJobPara runJobPara) throws Exception {
		
		this.getSqlMapClientTemplate().update("RunJobPara.update",runJobPara);
	}

	public List findByJobId(int jobId) throws Exception {
		List list=this.getSqlMapClientTemplate().queryForList("RunJobPara.findByJobId",jobId);
		return list;
	}

	public RunJobPara findByTypeParaId(int typeParaId,int jobId) throws Exception {
		Map map=new HashMap<String,Integer>();
		map.put("typeParaId", typeParaId);
		map.put("jobId", jobId);
		RunJobPara rjp=(RunJobPara) this.getSqlMapClientTemplate().queryForObject("RunJobPara.findByTypeParaId",map);
		return rjp;
	}
	
}
